package com.mall.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mall.db.domain.OperationLog;
import com.mall.db.service.OperationLogService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system/olc")
public class OperationLogController extends BaseController<OperationLog> {

    @Resource(name="operationLogService")
    private OperationLogService ols;


    @Override
    public Map<String, Object> find(OperationLog ol) {

        //实现分页

        PageHelper.startPage(ol.getPage(),ol.getLimit());

        QueryWrapper<OperationLog> qw = new QueryWrapper<>();
        List<OperationLog> list = ols.list(qw);

        PageInfo<OperationLog> page = new PageInfo<>(list,ol.getLimit());

        return this.findMap(page.getList(),page.getTotal());
    }
}
